import request from "@/utils/http"

export default {
    // 登录
    LoginAPI: (data) => request({
        url: `/system/login/`,
        method: 'post',
        data
    }),

    // 获取菜单列表
    getMenuAPI: () => request({
        url: `/system/menu/`,
        method: 'get',
        needToken: true
    }),
    
    // 创建菜单
    createMenuAPI: (data) => request({
        url: `/system/menu/`,
        method: 'post',
        data,
        needToken: true
    }),

    // 获取菜单详情
    getMenuDetailAPI: (id) => request({
        url: `/system/menu/${id}/`,
        method: 'get',
        needToken: true
    }),

    /**
     * 删除菜单
     * @param {*} id Number
     */
    deleteMenuDetailAPI: (id) => request({
        url: `/system/menu/${id}/`,
        method: 'delete',
        needToken: true
    }),

    /**
     * 更新菜单
     * @param {*} data Object
     */
    patchMenuDetailAPI: (data) => request({
        url: `/system/menu/${data.id}/`,
        method: 'patch',
        data,
        needToken: true
    }),


    // 获取当前登录用户信息
    getUserInfoAPI: () => request({
        url: `/system/user/1/`,
        method: 'get',
        needToken: true
    }),
    
}